home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * This mainloop below 'cycles' thru the animation.. It could be re-written to
- * 'ping-pong' or play the animation once over, etc.
-
- swidth = 320 ;screen width
- sheight = 256 ;screen height
- sdepth = 4 ;screen depth
-
- section test,code_c
-
- ProgStart: movem.l d0-d7/a0-a6,-(sp)
- bsr killsys
-
- *-------------- Setup IFF Anim "Play structure.."
-
- lea buf1,a0 ;ptr to anim screen buffer 1
- lea buf2,a1 ;ptr to anim screen buffer 2
- lea cop_dump+2(pc),a2 ;ptr to cols in copperlist
- lea animfile(pc),a3 ;ptr to animation to play
- lea Anim_Struct(pc),a6 ;ptr to animation struct mem
- move.l #endfile-animfile,d0 ;bytesize of animation file
- bsr _LVOAnimInit
-
- *-------------- main loop
-
- AnimLoop cmp.b #200,$dff006
- bne.s AnimLoop
-
- *-------------- Anim double buffer (swap screens)
-
- lea bplanes(pc),a0 ;ptr to bpls in copperlist
- moveq #40,d2 ;offset next bpl (interleaved)
- lea Anim_Struct(pc),a6 ;ptr to animation structure
- bsr.w _LVOAnimBuffer
-
- *-------------- Unpack current animation frame..
-
- lea Anim_Struct(pc),a6 ;ptr to animation structure
- moveq #40,d2 ;unpack screen width
- bsr.w _LVOAnimUnpackFrame
-
- *-------------- check if we`ve animated all frames..
-
- move.w frame_total(pc),d0
- cmp.w frame_current(pc),d0 ;last frame done?
- ble.s reset_frame
-
- *-------------- if not, get to next frame..
-
- addq.w #1,frame_current ;to next frame no.
-
- moveq #0,d0
- move.b frame_depth(pc),d0
- add.w d0,d0
- add.w d0,d0 ;inc to next frame gfx..
- add.l d0,frame_ptr ;save frame ptr
- bra.s inc_done
-
- *-------------- otherwise reset to 1st frame
-
- reset_frame: lea frame_list(pc),a1
- move.l a1,frame_ptr ;reset frame pointer
- clr.w frame_current ;reset frame number to 0
-
- inc_done: btst #6,$bfe001
- bne.b AnimLoop
-
- bsr.w returnsys
- movem.l (sp)+,d0-d7/a0-a6
- rts
-
- *-------------- Animation structure -: Required for every seperate animation
- * and configured by calling _LVOAnimInit with correct parameters.
-
- Anim_Struct: ds.l 1 ;IFF-Anim data ptr
- Anim_Length: ds.l 1 ;IFF-Anim data size
- Anim_Copper: ds.l 1 ;Palette copperlist dump adr
- Anim_Screen1: ds.l 1 ;Screen buffer 1
- Anim_Screen2: ds.l 1 ;Screen buffer 2
- Reserved: ds.l 2 ;not used (reserved for future use)
- Frame_Width: ds 1 ;Anim frame width
- Frame_Depth: ds 1 ;Anim frame depth
- Frame_Total: ds 1 ;Anim total frames
- Frame_Current: ds 1 ;Anim current frame no.
- Frame_Ptr: ds.l 1 ;Anim current frame gfx ptr
- Frame_List ds.l 75*4 ;storage for frame list pointers
- even ;a ptr`s used for each plane of frames
- ;thus upto 75 frames worth is allocated
-
- copperlist dc bplcon0,$0200,ddfstrt,$38,ddfstop,$d0
- dc diwstrt,$1681,diwstop,$36c1,$1fc,$0,$106,0
- dc bplmod1,(swidth/8)*(sdepth-1)
- dc bplmod2,(swidth/8)*(sdepth-1)
- bplanes: dc $0e0,0,$0e2,0,$0e4,0,$0e6,0,$0e8,0,$0ea,0,$0ec,0,$0ee,0
- cop_dump: dc $180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
- dc $190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
-
- dc $2809,-2,bplcon0,$4200 ;4 bitplanes..
- dc $ff09,-2,bplcon0,$0200
- dc -2
-
- include 'work:source/anim_code.i'
- animfile incbin 'work:source/shots.anim'
- endfile:
- section bssmem,bss_c
- buf1: ds.b (swidth/8)*(sheight)*(sdepth)
- buf2: ds.b (swidth/8)*(sheight)*(sdepth)
-